﻿
using Engine;
using Engine.Input;
using Game;
using GameEntitySystem;
using TemplatesDatabase;

public class NK9 : ComponentInventoryBase, IUpdateable
{
    public SubsystemProjectiles m_subsystemProjectiles;

    public SubsystemParticles m_subsystemParticles;

    public SubsystemTerrain m_subsystemTerrain;

    public SubsystemTimeOfDay m_subsystemTimeOfDay;

    public string xiuwei2;

    public SubsystemNK m_subsystemHL;

    public Game.Random random = new Game.Random();

    private float m_water;  //私有口渴值

    public float Water  //可调用口渴值（get获取值，set设置值）
    {
        get { return m_water; }
        set { m_water = MathUtils.Saturate(value); } //Saturate函数作用是将值限定在0到1
    }

    public ValueBarWidget WaterBarWidget    //玩家界面的口渴条
    {
        get;
        set;
    }
    private float m_xf;  //私有口渴值

    public float XF  //可调用口渴值（get获取值，set设置值）
    {
        get { return m_xf; }
        set { m_xf = MathUtils.Saturate(value); } //Saturate函数作用是将值限定在0到1
    }

    public ValueBarWidget XFBarWidget    //玩家界面的口渴条
    {
        get;
        set;
    }

    public float T    //玩家界面的口渴条
    {
        get;
        set;
    }

    public float Y    //玩家界面的口渴条
    {
        get;
        set;
    }

    public float ID //玩家界面的口渴条
    {
        get;
        set;
    }


    public ValueBarWidget PinMuBarWidget    //玩家界面的口渴条
    {
        get;
        set;
    }

    public float JCJZ;

    public string JCJZName;

    public InventorySlotWidget m_soldSlot;

    public ComponentShop m_componentShop;

    UpdateOrder IUpdateable.UpdateOrder => ((IUpdateable)componentPlayer).UpdateOrder;
    public void Update(float dt)//这里可以用if else if结构
    {
        int activeBlockValue = componentPlayer.ComponentMiner.ActiveBlockValue;
        int num66 = Terrain.ExtractContents(activeBlockValue);
        int num77 = componentPlayer.ComponentMiner.Inventory.GetSlotCount(componentPlayer.ComponentMiner.Inventory.ActiveSlotIndex);
        WaterBarWidget.Value = Water;   //口渴条的值（界面显示的格数）赋值为Water值（后台数据）        
        XFBarWidget.Value = XF;   //口渴条的值（界面显示的格数）赋值为Water值（后台数据）        
        XFBarWidget.LitBarColor = Color.White;
        string xiuwei2 = (componentPlayer.PlayerData.Level < 5) ? "0阶下" : (componentPlayer.PlayerData.Level >= 5 && componentPlayer.PlayerData.Level < 10) ? "0阶上" : (componentPlayer.PlayerData.Level >= 10 && componentPlayer.PlayerData.Level < 13) ? "1阶下" : (componentPlayer.PlayerData.Level >= 13 && componentPlayer.PlayerData.Level < 16) ? "1阶上" : (componentPlayer.PlayerData.Level >= 16 && componentPlayer.PlayerData.Level < 20) ? "1阶满" : (componentPlayer.PlayerData.Level >= 20 && componentPlayer.PlayerData.Level < 24) ? "2阶下" : (componentPlayer.PlayerData.Level >= 24 && componentPlayer.PlayerData.Level < 28) ? "2阶上" : (componentPlayer.PlayerData.Level >= 28 && componentPlayer.PlayerData.Level < 30) ? "2阶满" : (componentPlayer.PlayerData.Level >= 30 && componentPlayer.PlayerData.Level < 33) ? "3阶下" : (componentPlayer.PlayerData.Level >= 33 && componentPlayer.PlayerData.Level < 36) ? "3阶上" : (componentPlayer.PlayerData.Level >= 36 && componentPlayer.PlayerData.Level < 39) ? "3阶狂暴" : (componentPlayer.PlayerData.Level >= 39 && componentPlayer.PlayerData.Level < 42) ? "4阶下" : (componentPlayer.PlayerData.Level >= 42 && componentPlayer.PlayerData.Level < 46) ? "4阶上" : (componentPlayer.PlayerData.Level >= 46 && componentPlayer.PlayerData.Level < 50) ? "4阶高级" : (componentPlayer.PlayerData.Level >= 50 && componentPlayer.PlayerData.Level < 54) ? "5阶下" : (componentPlayer.PlayerData.Level >= 54 && componentPlayer.PlayerData.Level < 58) ? "5阶上" : (componentPlayer.PlayerData.Level >= 58 && componentPlayer.PlayerData.Level < 60) ? "6阶灭世" : (componentPlayer.PlayerData.Level >= 60 && componentPlayer.PlayerData.Level < 65) ? "6阶顶级" : (componentPlayer.PlayerData.Level >= 65 && componentPlayer.PlayerData.Level < 70) ? "神阶下世" : (componentPlayer.PlayerData.Level >= 70 && componentPlayer.PlayerData.Level < 90) ? "神阶灭世" : (componentPlayer.PlayerData.Level >= 90) ? "幻神" : "";
        string xiuwei99 = (Y < 1000) ? "0阶" : (Y >= 1000 && Y < 2000) ? "1阶" : (Y >= 2000 && Y < 3000) ? "2阶" : (Y >= 3000 && Y < 4000) ? "3阶" : (Y >= 4000 && Y < 5000) ? "4阶" : (Y >= 5000 && Y < 6000) ? "5阶" : (Y >= 6000 && Y < 7000) ? "6阶" : (Y >= 7000 && Y < 10000) ? "虚阶" : "";
        PinMuBarWidget.Value = Y;   //口渴条的值（界面显示的格数）赋值为Water值（后台数据）

        float XL = componentHealth.AttackResilience;
        float GJ = componentMiner.AttackPower;
        Vector3 playerPosition = componentPlayer.ComponentBody.Position;
        float DD = componentPlayer.PlayerData.Level;
        m_subsystemHL.JianJC = componentPlayer.PlayerData.Level;
        //Vector3 forward = Matrix.CreateFromQuaternion(componentMiner.ComponentCreature.ComponentCreatureModel.EyeRotation).Forward;

        PinMuBarWidget.IsVisible = (Y > 0);
        SWXL.IsVisible = (PinMuBarWidget.Value > 0);   //口渴条的值（界面显示的格数）赋值为Water值（后台数据）

        if (subsystemTime.PeriodicGameTimeEvent(5, 0.0))
        {
            PinMuBarWidget.Value = 0f;
            Y = 0f;
        }

        float x = componentPlayer.ComponentBody.StanceBoxSize.Y;
        float Velocity2 = (float)componentLocomotion.WalkSpeed;
        Block block = BlocksManager.Blocks[Terrain.ExtractContents(componentMiner.ActiveBlockValue)];
        float num123 = block.GetMeleePower(componentMiner.ActiveBlockValue);

        if (componentPlayer != null)
        {
            componentPlayer.ComponentGui.LevelLabelWidget.m_text = xiuwei2 + "\n" + "等级:" + componentPlayer.PlayerData.Level;
        }


        if (componentPlayer.ComponentVitalStats.Food >= 0.7f && XF < 1f)
        {
            if (subsystemTime.PeriodicGameTimeEvent(10, 0.0))
            {
                XF += 0.05f;
                XFBarWidget.Flash(10);
                componentPlayer.ComponentGui.DisplaySmallMessage("饱食度恢复San", Color.Yellow, blinking: true, playNotificationSound: false);
            }
        }
        if (componentPlayer.ComponentVitalStats.Food <= 0.2f)
        {
            if (subsystemTime.PeriodicGameTimeEvent(10, 0.0))
            {
                XF -= 0.05f;
                componentPlayer.ComponentGui.DisplaySmallMessage("饱食度掉落San", Color.Yellow, blinking: true, playNotificationSound: false);
                XFBarWidget.Flash(10);
            }
        }
        if (componentPlayer.ComponentVitalStats.Sleep <= 0.2f)
        {
            if (subsystemTime.PeriodicGameTimeEvent(30, 0.0))
            {
                XF -= 0.05f;
                componentPlayer.ComponentGui.DisplaySmallMessage("疲倦掉落San", Color.Yellow, blinking: true, playNotificationSound: false);
                XFBarWidget.Flash(10);
            }
        }
        if (componentPlayer.ComponentVitalStats.Sleep >= 1f && XF < 1f)
        {
            if (subsystemTime.PeriodicGameTimeEvent(10, 0.0))
            {
                XF += 0.05f;
                XFBarWidget.Flash(10);
                componentPlayer.ComponentGui.DisplaySmallMessage("你精神很好，恢复San", Color.Yellow, blinking: true, playNotificationSound: false);
            }
        }
        if (componentPlayer.ComponentHealth.Health <= 0.5f)
        {
            if (subsystemTime.PeriodicGameTimeEvent(30, 0.0))
            {
                XF -= 0.025f;
                componentPlayer.ComponentGui.DisplaySmallMessage("受伤掉落San", Color.Yellow, blinking: true, playNotificationSound: false);
                XFBarWidget.Flash(10);
            }
        }

        if (XF < 0.4)
        {

            componentPlayer.ComponentScreenOverlays.RedoutFactor = (1f - XF - 0.35f);
            if (XF <= 0f)
            {
                if (subsystemTime.PeriodicGameTimeEvent(10, 0.0))
                {
                    componentPlayer.ComponentGui.DisplaySmallMessage("San过低", Color.White, blinking: true, playNotificationSound: false);
                    componentHealth.Injure(0.15f * MathUtils.Abs(componentMiner.AttackPower), null, false, "自杀");
                }
            }
            if (subsystemTime.PeriodicGameTimeEvent(10, 0.0))
            {
                componentPlayer.ComponentGui.DisplaySmallMessage("San过低", Color.White, blinking: true, playNotificationSound: false);
            }

        }

        if (subsystemTime.PeriodicGameTimeEvent(120, 0.0))
        {
            componentPlayer.ComponentGui.DisplaySmallMessage("游戏天数:" + m_subsystemTimeOfDay.Day, new Color(255, 0, 0), blinking: true, playNotificationSound: false);
        }


        //升级系统
        if (num66 == 570 && subsystemTime.PeriodicGameTimeEvent(10.0, 0.0) && componentPlayer.PlayerData.Level < 10f)
        {
            componentPlayer.ComponentVitalStats.Stamina -= 0.1f;
            componentPlayer.ComponentMiner.RemoveActiveTool(1);
            componentPlayer.PlayerData.Level += 0.1f;
            componentPlayer.ComponentHealth.Injure(0.05f, null, ignoreInvulnerability: false, "你升级太猛。暴体而亡。"); ;
            componentPlayer.ComponentGui.DisplayLargeMessage("提示：", "10级之前效果更好", 5f, 0f);
        }

        flyButton.IsChecked = componentPlayer.ComponentLocomotion.IsCreativeFlyEnabled;
        #region 按钮 
        if (xiuweiButton.IsClicked || Keyboard.IsKeyDownOnce(Key.G))
        {
            componentPlayer.ComponentGui.ModalPanelWidget = new ShopWidget(componentPlayer.Entity.FindComponent<ComponentShop>(), componentPlayer, m_subsystemHL);
        }//阶级显示

        if ((flyButton.IsClicked || Keyboard.IsKeyDownOnce(Key.B)) && componentPlayer.PlayerData.Level >= 5f && componentPlayer.ComponentVitalStats.Stamina > 0)
        {
            flag2 = !flag2;
            componentPlayer.ComponentGui.DisplaySmallMessage("飞行:关闭", new Color(255, 0, 0), blinking: true, playNotificationSound: false);
            componentPlayer.ComponentVitalStats.Stamina -= 0.2f;
        }
        if ((flyButton.IsClicked || Keyboard.IsKeyDownOnce(Key.B)) && componentPlayer.PlayerData.Level < 5f)
        {
            componentPlayer.ComponentGui.DisplaySmallMessage("法术阶级不足(5级)", new Color(255, 0, 0), blinking: true, playNotificationSound: false);
        }
       
        if (fly2Button.IsClicked || Keyboard.IsKeyDownOnce(Key.J))
        {
            componentPlayer.ComponentGui.ModalPanelWidget = new CSWidget(componentPlayer.Entity.FindComponent<ComponentPlayer>(), m_subsystemHL);
        }
        //附加物品栏
        if (ID == 599)
        {
            if (num66 == 0)
            {
                JCJZ = 1f * (componentPlayer.PlayerData.Level * 0.39f);
            }
            else
            {
                JCJZ = 0f;
            }

            JCJZName = "攻击加成" + (JCJZ * 100) + "%";
        }
        else
        {
            JCJZ = 0f;
        }

        if (ID == 588)
        {
            JCJZName = "吸血效果";
        }

        if (ID == 587)
        {
            JCJZName = "还魂效果";
            if (subsystemTime.PeriodicGameTimeEvent(10.0, 0.0))
            {
                XF += 0.05f;
                componentPlayer.ComponentVitalStats.Food += 0.05f;
            }
        }

        if (ID == 589)
        {
            JCJZName = "烈焰吸收:" + componentHealth.FireResilience;
            componentHealth.FireResilience = 10000f;
        }
        Vector3 position = componentPlayer.ComponentBody.Position;
        if (ID == 592)
        {
            JCJZName = "雷焰领域";
            if (subsystemTime.PeriodicGameTimeEvent(30.0, 0.0))
            {
                this.m_componentBodies.Clear();
                this.m_subsystemBodies.FindBodiesAroundPoint(new Vector2(position.X, position.Z), 8f, this.m_componentBodies);
                if (this.m_componentBodies.Count > 0)
                {
                    foreach (ComponentBody componentBody2 in this.m_componentBodies.Array)
                    {
                        if (!this.m_subsystemPlayers.IsPlayer(componentBody2.Entity) && componentBody2.Entity.FindComponent<ComponentHealth>().Health > 0f)
                        {
                            this.subsystemSky.MakeLightningStrike(componentBody2.Position);
                            break;
                        }
                    }
                }
            }
        }

        if (ID == 590)
        {
            JCJZName = "复活";
            if (componentPlayer.ComponentHealth.Health <= 0f)
            {
                componentPlayer.ComponentHealth.Health = 0.1f;
            }
        }

        if (ID == 595)
        {
            JCJZName = "提升恢复速度";
            if (subsystemTime.PeriodicGameTimeEvent(5.0, 0.0))
            {
                componentPlayer.ComponentHealth.Health += (componentPlayer.PlayerData.Level * 0.001f);
                componentPlayer.ComponentVitalStats.Food += (componentPlayer.PlayerData.Level * 0.001f);
                XF += (componentPlayer.PlayerData.Level * 0.001f);
                Water += (componentPlayer.PlayerData.Level * 0.001f);
            }
        }


        if (ID == 0 && num66 != 0)
        {
            JCJZName = "无";
        }

        if (WalkButton.IsClicked || Keyboard.IsKeyDownOnce(Key.Y))
        {
            if (componentPlayer.PlayerData.Level > 5f)
            {
                flag3 = !flag3;
                componentPlayer.ComponentGui.DisplaySmallMessage("移速:关闭", new Color(255, 0, 0), blinking: true, playNotificationSound: false);
            }
            else
            {
                componentPlayer.ComponentGui.DisplaySmallMessage("等级必须大于5", new Color(255, 0, 0), blinking: true, playNotificationSound: false);
            }
        }//移动


        if (flag3 && Water > 0.3f && componentPlayer.ComponentHealth.Health > 0f && Water > 0.3f)
        {
            T = (float)(componentPlayer.PlayerData.Level * 0.1) + 1f;

            if (subsystemTime.PeriodicGameTimeEvent(1.0, 0.0))
            {
                componentPlayer.ComponentGui.DisplaySmallMessage("移速:开启", Color.LightRed, blinking: true, playNotificationSound: false);
            }
            componentMiner.ComponentCreature.ComponentCreatureModel.AimHandAngleOrder = 1.4f;
            componentMiner.ComponentCreature.ComponentCreatureModel.InHandItemOffsetOrder = new Vector3(-0.08f, -0.08f, 0.07f);
            componentMiner.ComponentCreature.ComponentCreatureModel.InHandItemRotationOrder = new Vector3(-0.7f, 0f, 0f);
            ComponentFirstPersonModel componentFirstPersonModel = componentMiner.Entity.FindComponent<ComponentFirstPersonModel>();
            componentFirstPersonModel.ItemOffsetOrder = new Vector3(-0.21f, 0.15f, 0.08f);
            componentFirstPersonModel.ItemRotationOrder = new Vector3(-0.7f, 0f, 0f);
            if (subsystemTime.PeriodicGameTimeEvent(2, 0.0))
            {
                Water -= (1f / componentPlayer.PlayerData.Level);
                m_subsystemParticles.AddParticleSystem(new PlayerParticle1(m_subsystemTerrain, playerPosition, x));
            }
        }
        else
        {
            T = 1f;
        }

        if (flag2 && componentPlayer.ComponentVitalStats.Stamina > 0)
        {
            componentMiner.ComponentCreature.ComponentCreatureModel.AimHandAngleOrder = 1.4f;
            componentMiner.ComponentCreature.ComponentCreatureModel.InHandItemOffsetOrder = new Vector3(-0.08f, -0.08f, 0.07f);
            componentMiner.ComponentCreature.ComponentCreatureModel.InHandItemRotationOrder = new Vector3(-0.7f, 0f, 0f);
            ComponentFirstPersonModel componentFirstPersonModel = componentMiner.Entity.FindComponent<ComponentFirstPersonModel>();
            componentFirstPersonModel.ItemOffsetOrder = new Vector3(-0.21f, 0.15f, 0.08f);
            componentFirstPersonModel.ItemRotationOrder = new Vector3(-0.7f, 0f, 0f);
            if (componentPlayer.PlayerData.Level < 30f && XF <= 0f)
            {
                if (subsystemTime.PeriodicGameTimeEvent(2, 0.0))
                {

                    m_subsystemParticles.AddParticleSystem(new PlayerParticle1(m_subsystemTerrain, playerPosition, x));
                }
            }
            if (componentPlayer.PlayerData.Level >= 30f && XF <= 0f)
            {
                if (subsystemTime.PeriodicGameTimeEvent(2, 0.0))
                {
                    m_subsystemParticles.AddParticleSystem(new PlayerParticle2(m_subsystemTerrain, playerPosition, x));
                }
            }
            componentBody.Velocity += 1.5f * Velocity2 * componentBody.Matrix.Up;
            componentBody.Velocity += 1.5f * Velocity2 * componentBody.Matrix.Forward;
            componentPlayer.ComponentVitalStats.Stamina -= 0.1f;
            if (subsystemTime.PeriodicGameTimeEvent(1.0, 0.0))
            {
                componentPlayer.ComponentGui.DisplaySmallMessage("飞行:开启", Color.LightRed, blinking: true, playNotificationSound: false);
                Water -= (1f / componentPlayer.PlayerData.Level);
            }
            if (componentPlayer.PlayerData.Level <= 30f)
            {
                if (subsystemTime.PeriodicGameTimeEvent(20.0, 0.0))
                {
                    componentPlayer.ComponentVitalStats.Stamina = 0.1f;
                }
            }
        }

        if (flag4 && Water > 0.3f)
        {
            if (subsystemTime.PeriodicGameTimeEvent(1.0, 0.0))
            {
                componentPlayer.ComponentGui.DisplaySmallMessage("内法治疗:开启", Color.LightRed, blinking: true, playNotificationSound: false);
            }
            componentMiner.ComponentCreature.ComponentCreatureModel.AimHandAngleOrder = 1.4f;
            componentMiner.ComponentCreature.ComponentCreatureModel.InHandItemOffsetOrder = new Vector3(-0.08f, -0.08f, 0.07f);
            componentMiner.ComponentCreature.ComponentCreatureModel.InHandItemRotationOrder = new Vector3(-0.7f, 0f, 0f);
            ComponentFirstPersonModel componentFirstPersonModel = componentMiner.Entity.FindComponent<ComponentFirstPersonModel>();
            componentFirstPersonModel.ItemOffsetOrder = new Vector3(-0.21f, 0.15f, 0.08f);
            componentFirstPersonModel.ItemRotationOrder = new Vector3(-0.7f, 0f, 0f);
            if (componentPlayer.PlayerData.Level < 30f && XF <= 0f)
            {
                if (subsystemTime.PeriodicGameTimeEvent(2, 0.0))
                {

                    m_subsystemParticles.AddParticleSystem(new PlayerParticle1(m_subsystemTerrain, playerPosition, x));
                }
            }
            if (componentPlayer.PlayerData.Level >= 30f && XF <= 0f)
            {
                if (subsystemTime.PeriodicGameTimeEvent(2, 0.0))
                {
                    m_subsystemParticles.AddParticleSystem(new PlayerParticle2(m_subsystemTerrain, playerPosition, x));
                }
            }
            if (subsystemTime.PeriodicGameTimeEvent(5.0, 0.0))
            {
                componentPlayer.ComponentHealth.Health += 0.25f;
                Water -= 0.2f;
            }
            if (subsystemTime.PeriodicGameTimeEvent(10.0, 0.0))
            {
                componentPlayer.ComponentVitalStats.Stamina = 0.1f;
            }
        }

        if (flag6 && Water > 0.3f && componentPlayer.ComponentHealth.Health > 0f)
        {
            if (subsystemTime.PeriodicGameTimeEvent(2.0, 0.0))
            {
                componentPlayer.ComponentGui.DisplaySmallMessage("治疗:开启（点击生物也可以治疗）", Color.LightRed, blinking: true, playNotificationSound: false);
            }
            componentMiner.ComponentCreature.ComponentCreatureModel.AimHandAngleOrder = 1.4f;
            componentMiner.ComponentCreature.ComponentCreatureModel.InHandItemOffsetOrder = new Vector3(-0.08f, -0.08f, 0.07f);
            componentMiner.ComponentCreature.ComponentCreatureModel.InHandItemRotationOrder = new Vector3(-0.7f, 0f, 0f);
            ComponentFirstPersonModel componentFirstPersonModel = componentMiner.Entity.FindComponent<ComponentFirstPersonModel>();
            componentFirstPersonModel.ItemOffsetOrder = new Vector3(-0.21f, 0.15f, 0.08f);
            componentFirstPersonModel.ItemRotationOrder = new Vector3(-0.7f, 0f, 0f);
            if (subsystemTime.PeriodicGameTimeEvent(2, 0.0))
            {
                XF += 0.1f;
                Water += 0.1f;
                componentPlayer.ComponentHealth.Health += 0.1f;
                m_subsystemParticles.AddParticleSystem(new PlayerParticle1(m_subsystemTerrain, playerPosition, x));
            }
        }

       
        #endregion

        float SYXL = componentHealth.m_lastHealth * componentHealth.AttackResilience;
        float Food = componentPlayer.ComponentVitalStats.Stamina;
        if (componentPlayer != null)
        {
            if (componentPlayer.ComponentVitalStats.Stamina <= 0.3f)
            {
                componentPlayer.ComponentVitalStats.Stamina = 0f;
                if (subsystemTime.PeriodicGameTimeEvent(1.0, 0.0))
                {
                    componentPlayer.ComponentGui.DisplaySmallMessage("你的法力过低,正在自动回复", new Color(255, 255, 25), blinking: true, playNotificationSound: false);
                }
                if (subsystemTime.PeriodicGameTimeEvent(10.0, 0.0))
                {
                    componentPlayer.ComponentVitalStats.Stamina = 1f;
                    componentPlayer.ComponentGui.DisplaySmallMessage("你已恢复", new Color(255, 255, 25), blinking: true, playNotificationSound: false);
                }
            }
            componentPlayer.ComponentVitalStats.Stamina = componentPlayer.ComponentVitalStats.Stamina;
            if (componentPlayer.PlayerData.Level >= 10f)
            {
                componentPlayer.ComponentVitalStats.Sleep = 0.99f * componentHealth.Health;
                //componentOnFire.m_fireDuration = 0f;
                //componentOnFire.m_onFireParticleSystem.IsStopped = true;
            }
        }
        if (componentHealth.Health > 0f)
        {
            if (subsystemTime.PeriodicGameTimeEvent(120.0, 0.0))
            {
                float XFZ = XF * 100;
                float WaterZ = Water * 100;
                componentPlayer.ComponentGui.DisplaySmallMessage("你的状态:" + "\n" + "内法:" + WaterZ + "%" + "\n" + "血量:" + SYXL + "\n" + "San:" + XFZ + "%", Color.LightRed, blinking: true, playNotificationSound: false);
            }
        }

        #region 等级
        bool xiuwei = false;
        if (!xiuwei)
        {
            float F = /*0.8f**/componentLocomotion.WalkSpeed/*+0.2f*/;
            float C = /*0.8f**/componentPlayer.ComponentVitalStats.Stamina/*+0.2f*/;
            float H = componentPlayer.ComponentVitalStats.Stamina += 0.2f;
            //0阶法师
            if (componentPlayer.ComponentHealth.Health <= 0 && componentPlayer.PlayerData.Level <= 1f)
            {
                componentPlayer.PlayerData.Level = 1.1f;
            }
            if (componentPlayer.PlayerData.Level >= 1f && componentPlayer.PlayerData.Level < 5f && componentHealth.Health > 0)
            {
                componentHealth.AttackResilience = 10f + 5 * F;
                componentHealth.FireResilience = 5f;
                componentHealth.FallResilience = 20f * m_subsystemHL.JC;
                componentHealth.Heal(0.00001f * C);
                componentLocomotion.WalkSpeed = 3.1f * H * T;
                componentLocomotion.JumpSpeed = 4.5f * H * T;
                componentMiner.AttackPower = 0.1f * (F * XF * JCJZ) + 1;
                componentPlayer.ComponentBody.Mass = 65f;

                if (subsystemTime.PeriodicGameTimeEvent(1.0, 0.0) && componentPlayer.PlayerData.Level < 1.01f)
                {
                    componentPlayer.PlayerData.Level += 0.1f;
                    componentPlayer.ComponentMiner.Inventory.AddSlotItems(componentPlayer.ComponentMiner.ActiveBlockValue, 599, 1);
                }
            }
            //0阶上级
            else if (componentPlayer.PlayerData.Level >= 5f && componentPlayer.PlayerData.Level < 10f && componentHealth.Health > 0)
            {
                componentHealth.AttackResilience = 20f + 5 * F;
                componentHealth.FireResilience = 20f;
                componentHealth.FallResilience = 25f * m_subsystemHL.JC;
                componentHealth.Heal(0.00005f * C);
                componentLocomotion.WalkSpeed = 3.2f * H * T;
                componentLocomotion.JumpSpeed = 4.6f * H * T;
                componentMiner.AttackPower = 0.15f * (F * XF * JCJZ) + 1;
                componentHealth.AirCapacity = 25f;

                componentPlayer.ComponentBody.Mass = 100f;

                if (componentPlayer.PlayerData.Level >= 5f && componentPlayer.PlayerData.Level < 5.001f && subsystemTime.PeriodicGameTimeEvent(10.0, 0.0))
                {
                    componentPlayer.ComponentGui.DisplaySmallMessage("0阶上级", new Color(255, 0, 0), blinking: true, playNotificationSound: false);
                }
            }
            //1阶下级法师
            else if (componentPlayer.PlayerData.Level >= 10f && componentPlayer.PlayerData.Level < 13f && componentHealth.Health > 0)
            {
                componentHealth.AttackResilience = 25f + 5 * F;
                componentHealth.FireResilience = 40f;
                componentHealth.FallResilience = 30f * m_subsystemHL.JC;
                componentHealth.Heal(0.00007f * C);
                componentLocomotion.WalkSpeed = 3.4f * H * T;
                componentLocomotion.JumpSpeed = 4.8f * H * T;
                componentMiner.AttackPower = 0.2f * (F * XF * JCJZ) + 1;
                componentHealth.AirCapacity = 25f;

                componentPlayer.ComponentBody.Mass = 150f;

                if (componentPlayer.PlayerData.Level >= 10.1f && componentPlayer.PlayerData.Level < 10.1001f && subsystemTime.PeriodicGameTimeEvent(10.0, 0.0))
                {
                    componentPlayer.ComponentGui.DisplaySmallMessage("1阶下级法师", new Color(255, 0, 0), blinking: true, playNotificationSound: false);
                }
            }
            //1阶上级法师
            else if (componentPlayer.PlayerData.Level >= 13f && componentPlayer.PlayerData.Level < 16f && componentHealth.Health > 0)
            {
                componentHealth.AttackResilience = 35f + 5 * F;
                componentHealth.FireResilience = 60f;
                componentHealth.FallResilience = 35f * m_subsystemHL.JC;
                componentHealth.Heal(0.0001f * C);
                componentLocomotion.WalkSpeed = 3.6f * H * T;
                componentLocomotion.JumpSpeed = 5f * H * T;
                componentMiner.AttackPower = 0.23f * (F * XF * JCJZ) + 1;
                componentHealth.AirCapacity = 25f;

                componentPlayer.ComponentBody.Mass = 200f;

                if (componentPlayer.PlayerData.Level >= 13f && componentPlayer.PlayerData.Level < 13.00001f && subsystemTime.PeriodicGameTimeEvent(10.0, 0.0))
                {
                    componentPlayer.ComponentGui.DisplaySmallMessage("1阶上级法师", new Color(255, 0, 0), blinking: true, playNotificationSound: false);
                }
            }
            //1阶高级法师
            else if (componentPlayer.PlayerData.Level >= 16f && componentPlayer.PlayerData.Level < 20f && componentHealth.Health > 0)
            {
                componentHealth.AttackResilience = 75f + 5 * F;
                componentHealth.FireResilience = 80f;
                componentHealth.FallResilience = 40f * m_subsystemHL.JC;
                componentHealth.Heal(0.00015f * C);
                componentLocomotion.WalkSpeed = 3.6f * H * T;
                componentLocomotion.JumpSpeed = 5f * H * T;
                componentMiner.AttackPower = 0.26f * (F * XF * JCJZ) + 1;
                componentHealth.AirCapacity = 50f;
                componentPlayer.ComponentBody.Mass = 200f;

                if (componentPlayer.PlayerData.Level >= 16f && componentPlayer.PlayerData.Level < 16.000001f && subsystemTime.PeriodicGameTimeEvent(10.0, 0.0))
                {

                    componentPlayer.ComponentGui.DisplaySmallMessage("1阶高级法师", new Color(255, 0, 0), blinking: true, playNotificationSound: false);
                }
            }
            //2阶低级法师
            else if (componentPlayer.PlayerData.Level >= 20f && componentPlayer.PlayerData.Level < 24f && componentHealth.Health > 0)
            {
                componentHealth.AttackResilience = 60f + 5 * F;
                componentHealth.FireResilience = 100f;
                componentHealth.FallResilience = 45f * m_subsystemHL.JC;
                componentHealth.AirCapacity = 100f;
                componentHealth.Heal(0.0002f * C);
                componentLocomotion.WalkSpeed = 4f * H * T;
                componentLocomotion.JumpSpeed = 5.6f * H * T;
                componentMiner.AttackPower = 0.28f * (F * XF * JCJZ) + 1;

                componentPlayer.ComponentBody.Mass = 200f;

                if (componentPlayer.PlayerData.Level >= 21f && componentPlayer.PlayerData.Level < 21.000001f && subsystemTime.PeriodicGameTimeEvent(10.0, 0.0))
                {
                    componentPlayer.ComponentGui.DisplaySmallMessage("2阶低级法师", new Color(255, 0, 0), blinking: true, playNotificationSound: false);
                }
            }
            //2阶上级法师
            else if (componentPlayer.PlayerData.Level >= 24f && componentPlayer.PlayerData.Level < 28f && componentHealth.Health > 0)
            {
                componentHealth.AttackResilience = 155f + 5 * F;
                componentHealth.FireResilience = 110f;
                componentHealth.FallResilience = 55f * m_subsystemHL.JC;
                componentHealth.Heal(0.00025f * C);
                componentLocomotion.WalkSpeed = 4.2f * H * T;
                componentLocomotion.JumpSpeed = 5.8f * H * T;
                componentMiner.AttackPower = 0.3f * (F * XF * JCJZ) + 1;
                componentHealth.AirCapacity = 100f;

                componentPlayer.ComponentBody.Mass = 200f;

                if (componentPlayer.PlayerData.Level >= 24f && componentPlayer.PlayerData.Level < 24.0000001f && subsystemTime.PeriodicGameTimeEvent(10.0, 0.0))
                {
                    componentPlayer.ComponentGui.DisplaySmallMessage("2阶上级法师", new Color(255, 0, 0), blinking: true, playNotificationSound: false);
                }
            }
            //二阶高级法师
            else if (componentPlayer.PlayerData.Level >= 29f && componentPlayer.PlayerData.Level < 30f && componentHealth.Health > 0)
            {
                componentHealth.AttackResilience = 200f + 5 * F;
                componentHealth.FireResilience = 140f;
                componentHealth.FallResilience = 70f;
                componentHealth.Heal(0.00027f * C);
                componentLocomotion.WalkSpeed = 4.5f * H * T;
                componentLocomotion.JumpSpeed = 6f * H * T;
                componentMiner.AttackPower = 0.32f * (F * XF * JCJZ) + 1;
                componentHealth.AirCapacity = 100f;

                componentPlayer.ComponentBody.Mass = 200f;

                if (componentPlayer.PlayerData.Level >= 29f && componentPlayer.PlayerData.Level < 29.00000001f && subsystemTime.PeriodicGameTimeEvent(10.0, 0.0))
                {
                    componentPlayer.ComponentGui.DisplaySmallMessage("二阶高级法师", new Color(255, 0, 0), blinking: true, playNotificationSound: false);
                }
            }
            //三阶下级法师
            else if (componentPlayer.PlayerData.Level >= 30f && componentPlayer.PlayerData.Level < 34f && componentHealth.Health > 0)
            {
                componentHealth.AttackResilience = 245f + 5 * F;
                componentHealth.FireResilience = 100f;
                componentHealth.FallResilience = 80f;
                componentHealth.Heal(0.00029f * C);
                componentLocomotion.WalkSpeed = 4.8f * H * T;
                componentLocomotion.JumpSpeed = 6f * H * T;
                componentMiner.AttackPower = 0.34f * (F * XF * JCJZ) + 1;
                componentHealth.AirCapacity = 100f;
                //componentPlayer.ComponentVitalStats.Sleep = 0.7f;
                componentPlayer.ComponentBody.Mass = 200f;

                if (componentPlayer.PlayerData.Level >= 31f && componentPlayer.PlayerData.Level < 31.0000001f && subsystemTime.PeriodicGameTimeEvent(10.0, 0.0))
                {
                    componentPlayer.ComponentGui.DisplaySmallMessage("三阶下级法师", new Color(255, 0, 0), blinking: true, playNotificationSound: false);
                }
            }
            //
            //三阶上级法师
            else if (componentPlayer.PlayerData.Level >= 34f && componentPlayer.PlayerData.Level < 38f && componentHealth.Health > 0)
            {
                componentHealth.AttackResilience = 280f + 5 * F;
                componentHealth.FireResilience = 100f;
                componentHealth.FallResilience = 100f;
                componentHealth.Heal(0.0003f * C);
                componentLocomotion.WalkSpeed = 5.3f * H * T;
                componentLocomotion.JumpSpeed = 6.5f * H * T;
                componentMiner.AttackPower = 0.36f * (F * XF * JCJZ) + 1;
                componentHealth.AirCapacity = 100f;
                //componentPlayer.ComponentVitalStats.Sleep = 0.7f;
                componentPlayer.ComponentBody.Mass = 500f;

                if (componentPlayer.PlayerData.Level >= 34f && componentPlayer.PlayerData.Level < 34.0000001f && subsystemTime.PeriodicGameTimeEvent(10.0, 0.0))
                {
                    componentPlayer.ComponentGui.DisplaySmallMessage("三阶上级法师", new Color(255, 0, 0), blinking: true, playNotificationSound: false);
                }
            }
            //三阶高级法师
            else if (componentPlayer.PlayerData.Level >= 38f && componentPlayer.PlayerData.Level < 39f && componentHealth.Health > 0)
            {
                componentHealth.AttackResilience = 300f + 5 * F;
                componentHealth.FireResilience = 120f;
                componentHealth.FallResilience = 16000000f;
                componentHealth.Heal(0.00032f * C);
                componentLocomotion.WalkSpeed = 5.6f * H * T;
                componentLocomotion.JumpSpeed = 6.8f * H * T;
                componentMiner.AttackPower = 0.38f * (F * XF * JCJZ) + 1;
                //componentPlayer.ComponentVitalStats.Sleep = 0.7f;
                //componentPlayer.ComponentVitalStats.Stamina = 1f;
                componentPlayer.ComponentFlu.m_fluDuration = 0f;
                componentPlayer.ComponentSickness.m_sicknessDuration = 0f;
                componentPlayer.ComponentBody.Mass = 500f;
                componentHealth.AirCapacity = 100f;

                if (componentPlayer.PlayerData.Level >= 38f && componentPlayer.PlayerData.Level < 38.0000001f && subsystemTime.PeriodicGameTimeEvent(10.0, 0.0))
                {
                    componentPlayer.ComponentGui.DisplaySmallMessage("三阶高级法师", new Color(255, 0, 0), blinking: true, playNotificationSound: false);
                }
            }
            //三阶狂暴法师
            else if (componentPlayer.PlayerData.Level >= 39f && componentPlayer.PlayerData.Level < 42f && componentHealth.Health > 0)
            {
                componentHealth.AttackResilience = 310f + 5 * F;
                componentHealth.FireResilience = 140f;
                componentHealth.FallResilience = 16000000f;
                componentHealth.Heal(0.00033f * C);
                componentLocomotion.WalkSpeed = 5.9f * H * T;
                componentLocomotion.JumpSpeed = 7.1f * H * T;
                componentMiner.AttackPower = 0.39f * (F * XF * JCJZ) + 1;
                //componentPlayer.ComponentVitalStats.Stamina = 1f;
                componentPlayer.ComponentFlu.m_fluDuration = 0f;
                componentPlayer.ComponentSickness.m_sicknessDuration = 0f;
                componentPlayer.ComponentBody.Mass = 1000f;
                componentHealth.AirCapacity = 150f;
                //componentPlayer.ComponentVitalStats.Sleep = 0.7f;

            }
            //四阶下级法师
            else if (componentPlayer.PlayerData.Level >= 42f && componentPlayer.PlayerData.Level < 46f && componentHealth.Health > 0)
            {
                componentHealth.AttackResilience = 320f + 5 * F;
                componentHealth.FireResilience = 160f;
                componentHealth.FallResilience = 16000000f;
                componentHealth.Heal(0.00034f * C);
                componentLocomotion.WalkSpeed = 6f * H * T;
                componentLocomotion.JumpSpeed = 7.3f * H * T;
                componentMiner.AttackPower = 0.4f * (F * XF * JCJZ) + 1;
                //componentPlayer.ComponentVitalStats.Stamina = 1f;
                componentPlayer.ComponentFlu.m_fluDuration = 0f;
                componentPlayer.ComponentSickness.m_sicknessDuration = 0f;
                componentPlayer.ComponentBody.Mass = 1500f;
                componentHealth.AirCapacity = 200f;
                //componentPlayer.ComponentVitalStats.Sleep = 0.7f;

            }
            //四阶上级法师
            else if (componentPlayer.PlayerData.Level >= 46f && componentPlayer.PlayerData.Level < 50f && componentHealth.Health > 0)
            {
                componentHealth.AttackResilience = 360f + 5 * F;
                componentHealth.FireResilience = 160f;
                componentHealth.FallResilience = 16000000f;
                componentHealth.Heal(0.00035f * C);
                componentLocomotion.WalkSpeed = 6.1f * H * T;
                componentLocomotion.JumpSpeed = 7.4f * H * T;
                componentMiner.AttackPower = 0.42f * (F * XF * JCJZ) + 1;
                //componentPlayer.ComponentVitalStats.Stamina = 1f;
                componentPlayer.ComponentFlu.m_fluDuration = 0f;
                componentPlayer.ComponentSickness.m_sicknessDuration = 0f;
                componentPlayer.ComponentBody.Mass = 2500f;//2500时雷劫，目前的血量属性可以造成4格半的红心
                componentHealth.AirCapacity = 250f;
                //componentPlayer.ComponentVitalStats.Sleep = 0.7f;
                if (componentPlayer.PlayerData.Level >= 46f && componentPlayer.PlayerData.Level < 46.0000001f && subsystemTime.PeriodicGameTimeEvent(10.0, 0.0))
                {
                    componentPlayer.ComponentGui.DisplaySmallMessage("四阶上级法师", new Color(255, 0, 0), blinking: true, playNotificationSound: false);
                }
                if (subsystemTime.PeriodicGameTimeEvent(30, 0.0))
                {
                    componentPlayer.PlayerData.Level += 0.2f;
                    componentPlayer.Project.FindSubsystem<SubsystemSky>().MakeLightningStrike(playerPosition);
                }
            }
            //
            //四阶高级法师
            else if (componentPlayer.PlayerData.Level >= 50f && componentPlayer.PlayerData.Level < 54f && componentHealth.Health > 0)
            {
                componentHealth.AttackResilience = 410f + 5 * F;
                componentHealth.FireResilience = 1800000f;
                componentHealth.FallResilience = 18000000f;
                componentHealth.Heal(0.00036f * C);
                componentLocomotion.WalkSpeed = 7.1f * H * T;
                componentLocomotion.JumpSpeed = 7.5f * H * T;
                componentMiner.AttackPower = 0.44f * (F * XF * JCJZ) + 1;
                //componentPlayer.ComponentVitalStats.Stamina = 1f;
                //componentPlayer.ComponentVitalStats.Stamina = 0.8f;
                componentPlayer.ComponentVitalStats.Temperature = 12f + 3 * F;
                componentPlayer.ComponentFlu.m_fluDuration = 0f;
                componentPlayer.ComponentSickness.m_sicknessDuration = 0f;
                componentPlayer.ComponentBody.Mass = 3000f;//可以抗住原版中火药桶
                componentHealth.AirCapacity = 2500000f;
                //componentPlayer.ComponentVitalStats.Sleep = 0.7f;
                if (componentPlayer.PlayerData.Level >= 51f && componentPlayer.PlayerData.Level < 51.0000001f && subsystemTime.PeriodicGameTimeEvent(10.0, 0.0))
                {
                    componentPlayer.ComponentGui.DisplaySmallMessage("四阶高级法师", new Color(255, 0, 0), blinking: true, playNotificationSound: false);
                }
                if (subsystemTime.PeriodicGameTimeEvent(2400, 0.0))
                {
                    componentPlayer.Project.FindSubsystem<SubsystemSky>().MakeLightningStrike(playerPosition);
                }
            }
            //5阶中极法师
            else if (componentPlayer.PlayerData.Level >= 54f && componentPlayer.PlayerData.Level < 56f && componentHealth.Health > 0)
            {
                componentHealth.AttackResilience = 450f + 5 * F;
                componentHealth.FireResilience = 1800000f;
                componentHealth.FallResilience = 18000000f;
                componentHealth.Heal(0.00038f * C);
                componentLocomotion.WalkSpeed = 7.15f * H * T;
                componentLocomotion.JumpSpeed = 7.55f * H * T;
                componentMiner.AttackPower = 0.46f * (F * XF * JCJZ) + 1;
                //componentPlayer.ComponentVitalStats.Stamina = 1f;
                //componentPlayer.ComponentVitalStats.Stamina = 0.8f;
                componentPlayer.ComponentVitalStats.Temperature = 12f + 3 * F;
                componentPlayer.ComponentFlu.m_fluDuration = 0f;
                componentPlayer.ComponentSickness.m_sicknessDuration = 0f;
                componentPlayer.ComponentBody.Mass = 3500f;
                componentHealth.AirCapacity = 2500000f;
                //componentPlayer.ComponentVitalStats.Sleep = 0.7f;

                if (componentPlayer.PlayerData.Level >= 54f && componentPlayer.PlayerData.Level < 54.0000001f && subsystemTime.PeriodicGameTimeEvent(10.0, 0.0))
                {
                    componentPlayer.ComponentGui.DisplaySmallMessage("5阶中极法师", new Color(255, 0, 0), blinking: true, playNotificationSound: false);
                }
                if (subsystemTime.PeriodicGameTimeEvent(2400, 0.0))
                {
                    componentPlayer.Project.FindSubsystem<SubsystemSky>().MakeLightningStrike(playerPosition);
                }
            }
            //5阶高级法师
            else if (componentPlayer.PlayerData.Level >= 56f && componentPlayer.PlayerData.Level < 58f && componentHealth.Health > 0)
            {
                componentHealth.AttackResilience = 500f + 5 * F;
                componentHealth.FireResilience = 1800000f;
                componentHealth.FallResilience = 18000000f;
                componentHealth.Heal(0.0004f * C);
                componentLocomotion.WalkSpeed = 7.2f * H * T;
                componentLocomotion.JumpSpeed = 7.6f * H * T;
                componentMiner.AttackPower = 0.48f * (F * XF * JCJZ) + 1;
                //componentPlayer.ComponentVitalStats.Stamina = 1f;
                //componentPlayer.ComponentVitalStats.Stamina = 0.8f;
                componentPlayer.ComponentVitalStats.Temperature = 12f + 3 * F;
                componentPlayer.ComponentFlu.m_fluDuration = 0f;
                componentPlayer.ComponentSickness.m_sicknessDuration = 0f;
                componentPlayer.ComponentBody.Mass = 4000f;
                componentHealth.AirCapacity = 2500000f;
                //componentPlayer.ComponentVitalStats.Sleep = 0.7f;
                if (subsystemTime.PeriodicGameTimeEvent(2400, 0.0))
                {
                    componentPlayer.Project.FindSubsystem<SubsystemSky>().MakeLightningStrike(playerPosition);
                }
                if (componentPlayer.PlayerData.Level >= 56f && componentPlayer.PlayerData.Level < 56.0000001f && subsystemTime.PeriodicGameTimeEvent(10.0, 0.0))
                {
                    componentPlayer.ComponentGui.DisplaySmallMessage("5阶高级法师", new Color(255, 0, 0), blinking: true, playNotificationSound: false);
                }
            }
            //6阶灭世法师
            else if (componentPlayer.PlayerData.Level >= 58f && componentPlayer.PlayerData.Level < 60f && componentHealth.Health > 0)
            {
                componentHealth.AttackResilience = 600f + 5 * F;
                componentHealth.FireResilience = 1800000f;
                componentHealth.FallResilience = 18000000f;
                componentHealth.Heal(0.00042f * C);
                componentLocomotion.WalkSpeed = 7.25f * H * T;
                componentLocomotion.JumpSpeed = 7.65f * H * T;
                componentMiner.AttackPower = 0.5f * (F * XF * JCJZ) + 1;
                componentPlayer.ComponentVitalStats.Food = 1f;
                // componentPlayer.ComponentVitalStats.Stamina = 0.8f;
                componentPlayer.ComponentVitalStats.Temperature = 12f + 3 * F;
                componentPlayer.ComponentFlu.m_fluDuration = 0f;
                componentPlayer.ComponentSickness.m_sicknessDuration = 0f;
                componentPlayer.ComponentBody.Mass = 4000f;
                componentHealth.AirCapacity = 2500000f;
                //componentPlayer.ComponentVitalStats.Sleep = 0.7f;
                if (subsystemTime.PeriodicGameTimeEvent(30, 0.0))
                {
                    componentPlayer.PlayerData.Level += 0.1f;
                    componentPlayer.Project.FindSubsystem<SubsystemSky>().MakeLightningStrike(playerPosition);
                }
                if (componentPlayer.PlayerData.Level >= 58f && componentPlayer.PlayerData.Level < 58.0000001f && subsystemTime.PeriodicGameTimeEvent(10.0, 0.0))
                {
                    componentPlayer.ComponentGui.DisplaySmallMessage("6阶灭世法师", new Color(255, 0, 0), blinking: true, playNotificationSound: false);
                }

            }
            //
            //6阶终极法师
            else if (componentPlayer.PlayerData.Level >= 60f && componentPlayer.PlayerData.Level < 65f && componentHealth.Health > 0)
            {
                componentHealth.AttackResilience = 1000f + 10 * F;
                componentHealth.FireResilience = 1800000f;
                componentHealth.FallResilience = 18000000f;
                componentHealth.Heal(0.00044f * C);
                componentLocomotion.WalkSpeed = 7.3f * H * T;
                componentLocomotion.JumpSpeed = 7.7f * H * T;
                componentMiner.AttackPower = 0.52f * (F * XF * JCJZ) + 1;
                //componentPlayer.ComponentVitalStats.Stamina = 0.8f;
                componentPlayer.ComponentVitalStats.Temperature = 12f + 3 * F;
                componentPlayer.ComponentVitalStats.Food = 1f;
                componentPlayer.ComponentFlu.m_fluDuration = 0f;
                componentPlayer.ComponentSickness.m_sicknessDuration = 0f;
                componentPlayer.ComponentBody.Mass = 5000f;
                componentHealth.AirCapacity = 2500000f;
                //componentPlayer.ComponentVitalStats.Sleep = 0.7f;

                if (componentPlayer.PlayerData.Level >= 61f && componentPlayer.PlayerData.Level < 61.00000001f && subsystemTime.PeriodicGameTimeEvent(10.0, 0.0))
                {
                    componentPlayer.ComponentGui.DisplaySmallMessage("6阶终极法师", new Color(255, 0, 0), blinking: true, playNotificationSound: false);
                }
                if (subsystemTime.PeriodicGameTimeEvent(2400, 0.0))
                {
                    componentPlayer.Project.FindSubsystem<SubsystemSky>().MakeLightningStrike(playerPosition);
                }
            }
            //神级初级法师
            else if (componentPlayer.PlayerData.Level >= 65f && componentPlayer.PlayerData.Level < 70f && componentHealth.Health > 0)
            {
                componentHealth.AttackResilience = 4040f + 10 * F;
                componentHealth.FireResilience = 1800000f;
                componentHealth.FallResilience = 18000000f;
                componentHealth.Heal(0.00046f * C);
                componentLocomotion.WalkSpeed = 7.35f * H * T;
                componentLocomotion.JumpSpeed = 7.75f * H * T;
                componentMiner.AttackPower = 0.53f * (F * XF * JCJZ) + 1;
                componentPlayer.ComponentVitalStats.Food = 1f;
                //componentPlayer.ComponentVitalStats.Stamina = 0.8f;
                componentPlayer.ComponentVitalStats.Temperature = 12f + 3 * F;
                componentPlayer.ComponentFlu.m_fluDuration = 0f;
                componentPlayer.ComponentSickness.m_sicknessDuration = 0f;
                componentPlayer.ComponentBody.Mass = 5000f;
                componentHealth.AirCapacity = 2500000f;
                //componentPlayer.ComponentVitalStats.Sleep = 0.7f;
                if (subsystemTime.PeriodicGameTimeEvent(2400, 0.0))
                {
                    componentPlayer.Project.FindSubsystem<SubsystemSky>().MakeLightningStrike(playerPosition);
                }
                if (componentPlayer.PlayerData.Level >= 65f && componentPlayer.PlayerData.Level < 65.00000001f && subsystemTime.PeriodicGameTimeEvent(10.0, 0.0))
                {
                    componentPlayer.ComponentGui.DisplaySmallMessage("神级初级法师", new Color(255, 0, 0), blinking: true, playNotificationSound: false);
                }
            }
            //神级终极法师
            else if (componentPlayer.PlayerData.Level >= 70f && componentPlayer.PlayerData.Level < 90f && componentHealth.Health > 0)
            {
                componentHealth.AttackResilience = 4540f + 20 * F;
                componentHealth.FireResilience = 1800000f;
                componentHealth.FallResilience = 18000000f;
                componentHealth.Heal(0.00048f * C);
                componentLocomotion.WalkSpeed = 7.4f * H * T;
                componentLocomotion.JumpSpeed = 7.8f * H * T;
                componentMiner.AttackPower = 0.54f * (F * XF * JCJZ) + 1;

                componentPlayer.ComponentVitalStats.Food = 1f;
                //componentPlayer.ComponentVitalStats.Stamina = 0.8f;
                componentPlayer.ComponentVitalStats.Temperature = 12f + 3 * F;
                componentPlayer.ComponentFlu.m_fluDuration = 0f;
                componentPlayer.ComponentSickness.m_sicknessDuration = 0f;
                componentPlayer.ComponentBody.Mass = 5000f;
                componentHealth.AirCapacity = 2500000f;
                //componentPlayer.ComponentVitalStats.Sleep = 0.7f;
                if (subsystemTime.PeriodicGameTimeEvent(2400, 0.0))
                {
                    componentPlayer.Project.FindSubsystem<SubsystemSky>().MakeLightningStrike(playerPosition);
                }
                if (componentPlayer.PlayerData.Level >= 71f && componentPlayer.PlayerData.Level < 71.0000001f && subsystemTime.PeriodicGameTimeEvent(10.0, 0.0))
                {
                    componentPlayer.ComponentGui.DisplaySmallMessage("神级终极法师", new Color(255, 0, 0), blinking: true, playNotificationSound: false);
                }
            }
            //神阶满级灭世法师
            else if (componentPlayer.PlayerData.Level >= 90f && componentHealth.Health > 0)
            {
                componentPlayer.ComponentHealth.Health = 1f;
                componentHealth.AttackResilience = 6000f;
                componentHealth.FireResilience = 1800000f;
                componentHealth.FallResilience = 18000000f;
                componentHealth.Heal(0.9f);
                componentLocomotion.WalkSpeed = 12f;
                componentLocomotion.JumpSpeed = 15f;
                componentMiner.AttackPower = 50f + m_subsystemHL.JianJC * XF;
                componentPlayer.ComponentVitalStats.Stamina = 1f;
                componentPlayer.ComponentVitalStats.Food = 1f;
                componentPlayer.ComponentVitalStats.Temperature = 12f;
                componentPlayer.ComponentVitalStats.m_satiation.Clear();
                componentPlayer.ComponentFlu.m_fluDuration = 0f;
                componentPlayer.ComponentSickness.m_sicknessDuration = 0f;
                componentPlayer.ComponentBody.Mass = 2100000000f;
                componentHealth.AirCapacity = 250000f;
                componentPlayer.ComponentVitalStats.Sleep = 0.7f;
                componentPlayer.ComponentVitalStats.Stamina = 1f;
                if (componentPlayer.PlayerData.Level >= 91f && componentPlayer.PlayerData.Level < 91.000000001f && subsystemTime.PeriodicGameTimeEvent(10.0, 0.0))
                {
                    componentPlayer.ComponentGui.DisplaySmallMessage("你是神极法师...", new Color(255, 0, 0), blinking: true, playNotificationSound: false);
                }
            }
        }
        #endregion
        //受伤系统
        if (componentPlayer.PlayerData.Level > 9f && componentPlayer.PlayerData.Level < 10f && componentHealth.Health > 0)
        {
            componentPlayer.PlayerData.Level = 9f;
            componentPlayer.ComponentGui.DisplayLargeMessage("警告！", "等级为9时只可通过一阶灵晶升级", 5f, 0f);
        }
        if (componentPlayer.PlayerData.Level > 19f && componentPlayer.PlayerData.Level < 20f && componentHealth.Health > 0)
        {
            componentPlayer.PlayerData.Level = 19f;
            componentPlayer.ComponentGui.DisplayLargeMessage("警告！", "等级为19时只可通过二阶灵晶升级", 5f, 0f);
        }
        if (componentPlayer.PlayerData.Level > 29f && componentPlayer.PlayerData.Level < 30f && componentHealth.Health > 0)
        {
            componentPlayer.PlayerData.Level = 29f;
            componentPlayer.ComponentGui.DisplayLargeMessage("警告！", "等级为29时只可通过三阶灵晶升级", 5f, 0f);
        }
        if (componentPlayer.PlayerData.Level > 39f && componentPlayer.PlayerData.Level < 40f && componentHealth.Health > 0)
        {
            componentPlayer.PlayerData.Level = 39f;
            componentPlayer.ComponentGui.DisplayLargeMessage("警告！", "等级为39时只可通过四阶灵晶升级", 5f, 0f);
        }
        if (componentPlayer.PlayerData.Level > 49f && componentPlayer.PlayerData.Level < 50f && componentHealth.Health > 0)
        {
            componentPlayer.PlayerData.Level = 49f;
            componentPlayer.ComponentGui.DisplayLargeMessage("警告！", "等级为49时只可通过五阶灵晶升级", 5f, 0f);
        }
        if (componentPlayer.PlayerData.Level > 59f && componentPlayer.PlayerData.Level < 60f && componentHealth.Health > 0)
        {
            componentPlayer.PlayerData.Level = 59f;
            componentPlayer.ComponentGui.DisplayLargeMessage("警告！", "等级为59时只可通过六阶灵晶升级", 5f, 0f);
        }
        if (componentPlayer.PlayerData.Level > 69f && componentPlayer.PlayerData.Level < 70f && componentHealth.Health > 0)
        {
            componentPlayer.PlayerData.Level = 69f;
            componentPlayer.ComponentGui.DisplayLargeMessage("警告！", "等级为69时只可通过灵下神阶混沌升级", 5f, 0f);
        }
        if (componentPlayer.PlayerData.Level > 89f && componentPlayer.PlayerData.Level < 90f && componentHealth.Health > 0)
        {
            componentPlayer.PlayerData.Level = 89f;
            componentPlayer.ComponentGui.DisplayLargeMessage("警告！", "等级为89时只可通过灵上神阶混沌升级", 5f, 0f);
        }
        if (componentPlayer != null)
        {
            if (componentPlayer.ComponentVitalStats.Stamina == 0f && componentPlayer.PlayerData.Level < 90f)
            {
                if (subsystemTime.PeriodicGameTimeEvent(10.0, 0.0))
                {
                    componentHealth.Injure(0.25f * MathUtils.Abs(componentMiner.AttackPower), null, false, "法力过低");
                }
            }

            if (Water <= 0.3f)
            {
                if (subsystemTime.PeriodicGameTimeEvent(25.0, 0.0))
                {
                    componentPlayer.ComponentGui.DisplaySmallMessage("内法过低，请用灵丹补充", new Color(255, 0, 0), blinking: true, playNotificationSound: false);
                }
            }
        }
    }
    public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
    {
        Player = Entity.FindComponent<ComponentPlayer>();
        componentPlayer = Entity.FindComponent<ComponentPlayer>(true);
        m_componentShop = Entity.FindComponent<ComponentShop>(true);

        m_subsystemHL = Project.FindSubsystem<SubsystemNK>(throwOnError: true);
        componentMiner = Entity.FindComponent<ComponentMiner>(true);
        componentHealth = Entity.FindComponent<ComponentHealth>(true);
        componentLocomotion = Entity.FindComponent<ComponentLocomotion>(true);
        subsystemTime = Project.FindSubsystem<SubsystemTime>(true);
        m_subsystemTimeOfDay = Project.FindSubsystem<SubsystemTimeOfDay>(true);
        m_subsystemProjectiles = Project.FindSubsystem<SubsystemProjectiles>(throwOnError: true);
        m_subsystemParticles = Project.FindSubsystem<SubsystemParticles>(throwOnError: true);
        m_subsystemTerrain = Project.FindSubsystem<SubsystemTerrain>(throwOnError: true);
        m_subsystemGameInfo = Project.FindSubsystem<SubsystemGameInfo>(true);
        m_subsystemPlayers = Project.FindSubsystem<SubsystemPlayers>(true);
        componentBody = Entity.FindComponent<ComponentBody>(true);
        m_subsystemBodies = Project.FindSubsystem<SubsystemBodies>(true);
        subsystemSky = Project.FindSubsystem<SubsystemSky>(true);
        ContainerWidget guiWidget = componentPlayer.GuiWidget;
        flyButton = guiWidget.Children.Find<ButtonWidget>("flyButton");
        fly2Button = guiWidget.Children.Find<ButtonWidget>("fly2Button");
        WalkButton = guiWidget.Children.Find<ButtonWidget>("WalkButton");

        m_soldSlot = guiWidget.Children.Find<InventorySlotWidget>("SoldSlot");
        m_soldSlot.AssignInventorySlot(m_componentShop, m_componentShop.SoldSlotIndex3);

        xiuweiButton = guiWidget.Children.Find<ButtonWidget>("xiuweiButton");

        XF = valuesDictionary.GetValue<float>("XF");  //从存档中project.xml文件的特定位置获取Water值    
        XFBarWidget = guiWidget.Children.Find<ValueBarWidget>("XF");
        Water = valuesDictionary.GetValue<float>("Water");  //从存档中project.xml文件的特定位置获取Water值
        WaterBarWidget = guiWidget.Children.Find<ValueBarWidget>("Water");
        PinMuBarWidget = guiWidget.Children.Find<ValueBarWidget>("PinMuBarWidget");
        Y = valuesDictionary.GetValue<float>("Y");  //从存档中project.xml文件的特定位置获取Water值


        SWXL = guiWidget.Children.Find<CanvasWidget>("SWXL");

        base.Load(valuesDictionary, idToEntityMap);
    }

    public override void Save(ValuesDictionary valuesDictionary, EntityToIdMap entityToIdMap)
    {
        valuesDictionary.SetValue("Water", Water);  //将Water值保存到存档中project.xml文件的特定位置
        valuesDictionary.SetValue("XF", XF);  //将Water值保存到存档中project.xml文件的特定位置                 
    }

    public float oldWalkSpeed;
    public float oldSleep;
    public float F;
    public float H;
    public ComponentPlayer Player;
    public ButtonWidget xiuweiButton;
    public ButtonWidget fly2Button;

    public ButtonWidget WalkButton;

    public CanvasWidget SWXL;

    //public ButtonWidget suomingButton;
    public ButtonWidget shopButton;
    //public ButtonWidget gengxinButton;
    public ButtonWidget flyButton;
    public SubsystemSky subsystemSky;
    //public ButtonWidget m_moreButton;
    public bool OO = true;
    //public Widget m_moreContentsWidget2;

    public SubsystemBodies m_subsystemBodies;
    public DynamicArray<ComponentBody> m_componentBodies = new DynamicArray<ComponentBody>();

    public ComponentPlayer componentPlayer;
    public SubsystemBlockEntities Entities;
    public ComponentOnFire componentOnFire;
    public ComponentMiner componentMiner;

    public bool flag = false;
    public bool flag2 = false;
    public bool flag3 = false;
    public bool flag4 = false;
    public bool flag5 = false;
    public bool flag6 = false;
    public SubsystemTime subsystemTime;

    public ComponentHealth componentHealth;

    public ComponentLocomotion componentLocomotion;
    public ComponentBody componentBody;

    public SubsystemGameInfo m_subsystemGameInfo;
    public ComponentCreature m_componentCreature;

    public SubsystemPlayers m_subsystemPlayers;
}